package cn.zwt.wolf.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * Created with IntelliJ IDEA.
 * User: LIJUN
 * Date: 14-4-17
 * Time: 下午4:54
 * To change this template use File | Settings | File Templates.
 */
public class SpringUtil implements ApplicationContextAware {
    private static ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public static Object getBean(String beanId) {
        Object bean = null;
        bean = applicationContext.getBean(beanId);
        return bean;
    }

}
